<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/5/10
  Time: 15:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品列表</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<!--bootstrap提供的容器类-->
<div class="container">
    <table class="table table-striped table-bordered table-hover">
        <thead>
        <tr>
            <th>商品名称</th>
            <th>货号</th>
            <th>库存数量</th>
            <th>销售数量</th>
            <th>警告数量</th>
            <th>市场价</th>
            <th>商店售价</th>
            <th>操作</th>
        </tr>
        </thead>

        <tbody>
        <a href="http://localhost:8080/JavaWebTomCat/goods/add">添加商品</a>
        <c:forEach items="${pageInfo.list}" var="goodsInfo">
            <tr>
                <td>${goodsInfo.goodsName}</td>
                <td>${goodsInfo.goodsSerial}</td>
                <td>${goodsInfo.storeNumber}</td>
                <td>${goodsInfo.selledNumber}</td>
                <td>${goodsInfo.warnNumber}</td>
                <td>${goodsInfo.marketPrice}</td>
                <td>${goodsInfo.shopPrice}</td>
                <td>
                    <a href="delete.jsp?goodsId=${goodsInfo.goodsId}">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <div class="row clearfix">
        <div class="col-md-6 column">
            <ul class="pagination">
                <!--当前页不是第一页，则启用上一页按钮-->
                <c:if test="${!pageInfo.isFirstPage}">
                    <li>
                        <a href="http://localhost:8080/JavaWebTomCat/search?pageNum=${pageInfo.prePage}">上一页</a>
                    </li>
                </c:if>

                <!--如果当前页是第一页，则禁用上一页按钮-->
                <c:if test="${pageInfo.isFirstPage}">
                    <li class="disabled">
                        <a>上一页</a>
                    </li>
                </c:if>

                <c:forEach items="${pageInfo.navigatepageNums}" var="i">
                    <c:if test="${pageInfo.pageNum==i}">
                        <li class="active">
                            <a href="http://localhost:8080/JavaWebTomCat/search?pageNum=${i}">${i}</a>
                        </li>
                    </c:if>

                    <c:if test="${pageInfo.pageNum != i}">
                        <li>
                            <a href="http://localhost:8080/JavaWebTomCat/search?pageNum=${i}">${i}</a>
                        </li>
                    </c:if>

                </c:forEach>

                <!--当前页不是最后一页，则启用下一页按钮-->
                <c:if test="${!pageInfo.isLastPage}">
                    <li>
                        <a href="http://localhost:8080/JavaWebTomCat/search?pageNum=${pageInfo.nextPage}">下一页</a>
                    </li>
                </c:if>
                <!--当前页是最后一页，则禁用下一页按钮-->
                <c:if test="${pageInfo.isLastPage}">
                    <li class="disabled">
                        <a>下一页</a>
                    </li>
                </c:if>
            </ul>
        </div>

    </div>

</div>
</body>
</html>
